<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>视频工具 Web API 文档</title>
    <style>
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            line-height: 1.6;
            margin: 0;
            padding: 20px;
            background-color: #f5f5f5;
        }
        .container {
            max-width: 1200px;
            margin: 0 auto;
            background: white;
            padding: 30px;
            border-radius: 10px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        }
        h1 {
            color: #2c3e50;
            text-align: center;
            border-bottom: 3px solid #3498db;
            padding-bottom: 10px;
        }
        h2 {
            color: #34495e;
            border-left: 4px solid #3498db;
            padding-left: 15px;
            margin-top: 30px;
        }
        h3 {
            color: #2c3e50;
            margin-top: 25px;
        }
        .endpoint {
            background: #f8f9fa;
            border: 1px solid #e9ecef;
            border-radius: 8px;
            padding: 20px;
            margin: 15px 0;
        }
        .method {
            display: inline-block;
            padding: 5px 12px;
            border-radius: 4px;
            color: white;
            font-weight: bold;
            margin-right: 10px;
        }
        .get { background-color: #28a745; }
        .post { background-color: #007bff; }
        .url {
            font-family: 'Courier New', monospace;
            background: #e9ecef;
            padding: 8px 12px;
            border-radius: 4px;
            color: #495057;
        }
        .description {
            margin: 10px 0;
            color: #6c757d;
        }
        .params {
            margin: 15px 0;
        }
        .param {
            background: #f8f9fa;
            border-left: 3px solid #17a2b8;
            padding: 10px;
            margin: 5px 0;
        }
        .param-name {
            font-weight: bold;
            color: #495057;
        }
        .param-type {
            color: #6c757d;
            font-size: 0.9em;
        }
        .example {
            background: #f8f9fa;
            border: 1px solid #dee2e6;
            border-radius: 4px;
            padding: 15px;
            margin: 10px 0;
            font-family: 'Courier New', monospace;
            white-space: pre-wrap;
        }
        .response {
            margin: 15px 0;
        }
        .response-example {
            background: #e8f5e8;
            border: 1px solid #c3e6c3;
            border-radius: 4px;
            padding: 15px;
            font-family: 'Courier New', monospace;
            white-space: pre-wrap;
        }
        .category {
            margin: 30px 0;
            padding: 20px;
            border: 1px solid #dee2e6;
            border-radius: 8px;
            background: #f8f9fa;
        }
        .category h2 {
            color: #495057;
            margin-top: 0;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>🎬 视频工具 Web API 文档</h1>
        
        <div class="description">
            <p>本API提供视频处理、音频处理、图片处理等功能，基于Flask框架构建，采用蓝图架构组织代码。</p>
            <p><strong>基础URL:</strong> <code>http://localhost:5000</code></p>
            <p><strong>API版本:</strong> 1.0.0</p>
        </div>

        <h2>📋 API概览</h2>
        <div class="endpoint">
            <span class="method get">GET</span>
            <span class="url">/</span>
            <div class="description">获取API根路径信息，显示所有可用的端点</div>
        </div>

        <div class="category">
            <h2>🔊 音频处理 API</h2>
            <p>提供音频提取、音频合并等功能</p>

            <div class="endpoint">
                <span class="method post">POST</span>
                <span class="url">/audio/extract</span>
                <div class="description">从视频文件中提取音频</div>
                
                <div class="params">
                    <h4>参数:</h4>
                    <div class="param">
                        <div class="param-name">video</div>
                        <div class="param-type">文件 (multipart/form-data)</div>
                        <div>要提取音频的视频文件</div>
                    </div>
                </div>

                <div class="example">
curl -X POST http://localhost:5000/audio/extract \
  -F "video=@sample_video.mp4"
                </div>

                <div class="response">
                    <h4>响应:</h4>
                    <div class="response-example">音频文件 (MP3格式)</div>
                </div>
            </div>

            <div class="endpoint">
                <span class="method post">POST</span>
                <span class="url">/audio/merge</span>
                <div class="description">合并两个音频文件</div>
                
                <div class="params">
                    <h4>参数:</h4>
                    <div class="param">
                        <div class="param-name">audio1</div>
                        <div class="param-type">文件 (multipart/form-data)</div>
                        <div>第一个音频文件</div>
                    </div>
                    <div class="param">
                        <div class="param-name">audio2</div>
                        <div class="param-type">文件 (multipart/form-data)</div>
                        <div>第二个音频文件</div>
                    </div>
                </div>

                <div class="example">
curl -X POST http://localhost:5000/audio/merge \
  -F "audio1=@audio1.mp3" \
  -F "audio2=@audio2.mp3"
                </div>

                <div class="response">
                    <h4>响应:</h4>
                    <div class="response-example">合并后的音频文件 (MP3格式)</div>
                </div>
            </div>

            <div class="endpoint">
                <span class="method post">POST</span>
                <span class="url">/audio/merge_with_timestamps</span>
                <div class="description">根据时间戳合并音频文件，在空白处添加静音</div>
                
                <div class="params">
                    <h4>参数:</h4>
                    <div class="param">
                        <div class="param-name">data</div>
                        <div class="param-type">JSON (multipart/form-data)</div>
                        <div>包含时间戳和文件信息的JSON数据</div>
                    </div>
                    <div class="param">
                        <div class="param-name">path</div>
                        <div class="param-type">字符串 (可选)</div>
                        <div>自定义路径，与UPLOAD_FOLDER拼接，用于指定音频文件位置</div>
                    </div>
                    <div class="param">
                        <div class="param-name">gain_db</div>
                        <div class="param-type">浮点数 (JSON内，可选)</div>
                        <div>全局增益（单位：dB）。为所有输入音频统一提升/降低音量（例如：3、6、9）。</div>
                    </div>
                    <div class="param">
                        <div class="param-name">gains_db</div>
                        <div class="param-type">数组 (JSON内，可选)</div>
                        <div>逐段增益（单位：dB），与音频段顺序一一对应。长度需与 <code>files</code> / <code>timestamps</code> 数量一致；若同时提供 <code>gain_db</code> 与 <code>gains_db</code>，逐段增益优先。</div>
                    </div>
                    <div class="param">
                        <div class="param-name">file_0, file_1, ...</div>
                        <div class="param-type">文件 (multipart/form-data)</div>
                        <div>音频文件，按顺序上传（向后兼容）</div>
                    </div>
                </div>

                <div class="example">
# 使用默认路径
curl -X POST http://localhost:5000/audio/merge_with_timestamps \
  -F 'data={
    "timestamps": [
      {"start_time": "00:00:00.000", "end_time": "00:00:05.000"},
      {"start_time": "00:00:10.000", "end_time": "00:00:15.000"}
    ],
    "files": ["audio1.mp3", "audio2.mp3"]
  }'

# 使用自定义路径
curl -X POST http://localhost:5000/audio/merge_with_timestamps \
  -F 'data={
    "timestamps": [
      {"start_time": "00:00:00.000", "end_time": "00:00:05.000"},
      {"start_time": "00:00:10.000", "end_time": "00:00:15.000"}
    ],
    "files": ["audio1.mp3", "audio2.mp3"],
    "path": "custom/audio/path"
  }'

# 使用全局增益（gain_db），单位 dB
curl -X POST http://localhost:5000/audio/merge_with_timestamps \
  -F 'data={
    "timestamps": [
      {"start_time": "00:00:00.000", "end_time": "00:00:05.000"},
      {"start_time": "00:00:10.000", "end_time": "00:00:15.000"}
    ],
    "files": ["audio1.mp3", "audio2.mp3"],
    "gain_db": 6
  }'

# 使用逐段增益（gains_db），单位 dB，数组长度需与段数一致
curl -X POST http://localhost:5000/audio/merge_with_timestamps \
  -F 'data={
    "timestamps": [
      {"start_time": "00:00:00.000", "end_time": "00:00:05.000"},
      {"start_time": "00:00:10.000", "end_time": "00:00:15.000"}
    ],
    "files": ["audio1.mp3", "audio2.mp3"],
    "gains_db": [3, 9]
  }'

# 使用文件上传方式（向后兼容）
curl -X POST http://localhost:5000/audio/merge_with_timestamps \
  -F 'data={
    "timestamps": [
      {"start_time": "00:00:00.000", "end_time": "00:00:05.000"},
      {"start_time": "00:00:10.000", "end_time": "00:00:15.000"}
    ]
  }' \
  -F "file_0=@audio1.mp3" \
  -F "file_1=@audio2.mp3"
                </div>

                <div class="response">
                    <h4>响应:</h4>
                    <div class="response-example">根据时间戳合并后的音频文件 (MP3格式)</div>
                </div>
            </div>
        </div>

        <div class="category">
            <h2>📁 文件上传 API</h2>
            <p>提供音频文件上传、批量上传等功能</p>

            <div class="endpoint">
                <span class="method post">POST</span>
                <span class="url">/upload/audio</span>
                <div class="description">上传单个音频文件</div>
                
                <div class="params">
                    <h4>参数:</h4>
                    <div class="param">
                        <div class="param-name">file</div>
                        <div class="param-type">文件 (multipart/form-data)</div>
                        <div>要上传的音频文件</div>
                    </div>
                    <div class="param">
                        <div class="param-name">path</div>
                        <div class="param-type">字符串 (可选)</div>
                        <div>自定义路径，与UPLOAD_FOLDER拼接，用于指定上传位置</div>
                    </div>
                </div>

                <div class="example">
# 使用默认路径
curl -X POST http://localhost:5000/upload/audio \
  -F "file=@audio.mp3"

# 使用自定义路径
curl -X POST http://localhost:5000/upload/audio \
  -F "file=@audio.mp3" \
  -F "path=custom/audio/path"
                </div>

                <div class="response">
                    <h4>响应:</h4>
                    <div class="response-example">{
  "success": true,
  "filename": "audio.mp3",
  "original_filename": "audio.mp3",
  "file_path": "/data/uploads/audio.mp3",
  "file_size": 1024000,
  "upload_folder": "/data/uploads",
  "custom_path": null,
  "message": "文件上传成功"
}</div>
                </div>
            </div>

            <div class="endpoint">
                <span class="method post">POST</span>
                <span class="url">/upload/audio/batch</span>
                <div class="description">批量上传音频文件</div>
                
                <div class="params">
                    <h4>参数:</h4>
                    <div class="param">
                        <div class="param-name">file_0, file_1, ...</div>
                        <div class="param-type">文件 (multipart/form-data)</div>
                        <div>要上传的音频文件，支持多个文件</div>
                    </div>
                    <div class="param">
                        <div class="param-name">path</div>
                        <div class="param-type">字符串 (可选)</div>
                        <div>自定义路径，与UPLOAD_FOLDER拼接，用于指定上传位置</div>
                    </div>
                </div>

                <div class="example">
# 使用默认路径
curl -X POST http://localhost:5000/upload/audio/batch \
  -F "file_0=@audio1.mp3" \
  -F "file_1=@audio2.mp3" \
  -F "file_2=@audio3.mp3"

# 使用自定义路径
curl -X POST http://localhost:5000/upload/audio/batch \
  -F "file_0=@audio1.mp3" \
  -F "file_1=@audio2.mp3" \
  -F "path=custom/audio/path"
                </div>

                <div class="response">
                    <h4>响应:</h4>
                    <div class="response-example">{
  "success": true,
  "uploaded_files": [
    {
      "filename": "audio1.mp3",
      "original_filename": "audio1.mp3",
      "file_path": "/data/uploads/audio1.mp3",
      "file_size": 1024000,
      "upload_folder": "/data/uploads"
    },
    {
      "filename": "audio2.mp3",
      "original_filename": "audio2.mp3",
      "file_path": "/data/uploads/audio2.mp3",
      "file_size": 2048000,
      "upload_folder": "/data/uploads"
    }
  ],
  "count": 2,
  "upload_folder": "/data/uploads",
  "custom_path": null,
  "message": "成功上传 2 个文件到 /data/uploads"
}</div>
                </div>
            </div>
        </div>

        <div class="category">
            <h2>📝 字幕处理 API</h2>
            <p>提供视频字幕添加、字幕格式化等功能</p>

            <div class="endpoint">
                <span class="method post">POST</span>
                <span class="url">/subtitle/format</span>
                <div class="description">格式化字幕文件，将长句子按停顿处分割</div>
                
                <div class="params">
                    <h4>参数:</h4>
                    <div class="param">
                        <div class="param-name">subtitle</div>
                        <div class="param-type">文件 (multipart/form-data)</div>
                        <div>要格式化的字幕文件 (SRT格式)</div>
                    </div>
                    <div class="param">
                        <div class="param-name">max_chars</div>
                        <div class="param-type">整数 (可选，默认20)</div>
                        <div>每行最大字符数</div>
                    </div>
                </div>

                <div class="example">
curl -X POST http://localhost:5000/subtitle/format \
  -F "subtitle=@subtitle.srt" \
  -F "max_chars=15"
                </div>

                <div class="response">
                    <h4>响应:</h4>
                    <div class="response-example">格式化后的字幕文件 (SRT格式)</div>
                </div>
            </div>

            <div class="endpoint">
                <span class="method post">POST</span>
                <span class="url">/subtitle/add</span>
                <div class="description">为视频添加字幕</div>
                
                <div class="params">
                    <h4>参数:</h4>
                    <div class="param">
                        <div class="param-name">video</div>
                        <div class="param-type">文件 (multipart/form-data)</div>
                        <div>要添加字幕的视频文件</div>
                    </div>
                    <div class="param">
                        <div class="param-name">subtitle</div>
                        <div class="param-type">文件 (multipart/form-data)</div>
                        <div>字幕文件 (SRT格式)</div>
                    </div>
                </div>

                <div class="example">
curl -X POST http://localhost:5000/subtitle/add \
  -F "video=@sample_video.mp4" \
  -F "subtitle=@subtitle.srt"
                </div>

                <div class="response">
                    <h4>响应:</h4>
                    <div class="response-example">带字幕的视频文件 (MP4格式)</div>
                </div>
            </div>

            <div class="endpoint">
                <span class="method post">POST</span>
                <span class="url">/subtitle/apply</span>
                <div class="description">应用字幕设置到视频，支持预览功能</div>
                
                <div class="params">
                    <h4>参数:</h4>
                    <div class="param">
                        <div class="param-name">video</div>
                        <div class="param-type">文件 (multipart/form-data)</div>
                        <div>要添加字幕的视频文件</div>
                    </div>
                    <div class="param">
                        <div class="param-name">subtitle</div>
                        <div class="param-type">文件 (multipart/form-data)</div>
                        <div>字幕文件 (SRT格式)</div>
                    </div>
                    <div class="param">
                        <div class="param-name">subtitle_data</div>
                        <div class="param-type">字符串 (JSON格式)</div>
                        <div>字幕设置信息，包含样式、位置等配置</div>
                    </div>
                    <div class="param">
                        <div class="param-name">generate_preview</div>
                        <div class="param-type">布尔值 (可选，默认false)</div>
                        <div>是否生成预览视频</div>
                    </div>
                    <div class="param">
                        <div class="param-name">preview_duration</div>
                        <div class="param-type">整数 (可选，默认10)</div>
                        <div>预览视频时长（秒）</div>
                    </div>
                </div>

                <div class="example">
curl -X POST http://localhost:5000/subtitle/apply \
  -F "video=@sample_video.mp4" \
  -F "subtitle=@subtitle.srt" \
  -F "subtitle_data={\"subtitle_style\":{\"color\":\"#ffffff\",\"strokeColor\":\"#000000\",\"size\":24},\"subtitle_positions\":[{\"y_percentage\":0.8}]}" \
  -F "generate_preview=true" \
  -F "preview_duration=10"
                </div>

                <div class="response">
                    <h4>响应:</h4>
                    <div class="response-example">带字幕的视频文件 (MP4格式，如果启用预览则只包含指定时长的片段)</div>
                </div>

                <div class="description">
                    <h4>功能说明:</h4>
                    <ul>
                        <li><strong>预览功能</strong>: 当 <code>generate_preview=true</code> 时，生成的视频将只包含指定时长的片段，用于快速预览字幕效果</li>
                        <li><strong>时长控制</strong>: <code>preview_duration</code> 参数控制预览视频的时长，默认10秒</li>
                        <li><strong>智能截取</strong>: 预览片段会从视频的中间部分开始，确保包含有意义的字幕内容</li>
                        <li><strong>完整处理</strong>: 当 <code>generate_preview=false</code> 或不设置时，生成完整的带字幕视频</li>
                    </ul>
                </div>
            </div>
        </div>

        <div class="category">
            <h2>🖼️ 图片处理 API</h2>
            <p>提供水印去除、GIF创建等功能</p>

            <div class="endpoint">
                <span class="method post">POST</span>
                <span class="url">/image/remove_watermark</span>
                <div class="description">去除视频中的水印</div>
                
                <div class="params">
                    <h4>参数:</h4>
                    <div class="param">
                        <div class="param-name">video</div>
                        <div class="param-type">文件 (multipart/form-data)</div>
                        <div>要去除水印的视频文件</div>
                    </div>
                    <div class="param">
                        <div class="param-name">x</div>
                        <div class="param-type">整数</div>
                        <div>水印区域的X坐标</div>
                    </div>
                    <div class="param">
                        <div class="param-name">y</div>
                        <div class="param-type">整数</div>
                        <div>水印区域的Y坐标</div>
                    </div>
                    <div class="param">
                        <div class="param-name">width</div>
                        <div class="param-type">整数</div>
                        <div>水印区域的宽度</div>
                    </div>
                    <div class="param">
                        <div class="param-name">height</div>
                        <div class="param-type">整数</div>
                        <div>水印区域的高度</div>
                    </div>
                </div>

                <div class="example">
curl -X POST http://localhost:5000/image/remove_watermark \
  -F "video=@sample_video.mp4" \
  -F "x=100" \
  -F "y=50" \
  -F "width=200" \
  -F "height=100"
                </div>

                <div class="response">
                    <h4>响应:</h4>
                    <div class="response-example">去除水印后的视频文件 (MP4格式)</div>
                </div>
            </div>

            <div class="endpoint">
                <span class="method post">POST</span>
                <span class="url">/image/create_gif</span>
                <div class="description">从视频创建GIF动画</div>
                
                <div class="params">
                    <h4>参数:</h4>
                    <div class="param">
                        <div class="param-name">video</div>
                        <div class="param-type">文件 (multipart/form-data)</div>
                        <div>要转换为GIF的视频文件</div>
                    </div>
                    <div class="param">
                        <div class="param-name">duration</div>
                        <div class="param-type">整数 (可选，默认10)</div>
                        <div>GIF的持续时间（秒）</div>
                    </div>
                    <div class="param">
                        <div class="param-name">fps</div>
                        <div class="param-type">整数 (可选，默认10)</div>
                        <div>GIF的帧率</div>
                    </div>
                </div>

                <div class="example">
curl -X POST http://localhost:5000/image/create_gif \
  -F "video=@sample_video.mp4" \
  -F "duration=15" \
  -F "fps=12"
                </div>

                <div class="response">
                    <h4>响应:</h4>
                    <div class="response-example">GIF动画文件</div>
                </div>
            </div>
        </div>

        <div class="category">
            <h2>🎥 视频处理 API</h2>
            <p>提供视频格式转换、压缩、信息获取等功能</p>

            <div class="endpoint">
                <span class="method post">POST</span>
                <span class="url">/video/convert</span>
                <div class="description">转换视频格式</div>
                
                <div class="params">
                    <h4>参数:</h4>
                    <div class="param">
                        <div class="param-name">video</div>
                        <div class="param-type">文件 (multipart/form-data)</div>
                        <div>要转换格式的视频文件</div>
                    </div>
                    <div class="param">
                        <div class="param-name">format</div>
                        <div class="param-type">字符串 (可选，默认mp4)</div>
                        <div>目标格式 (mp4, avi, mov, mkv等)</div>
                    </div>
                </div>

                <div class="example">
curl -X POST http://localhost:5000/video/convert \
  -F "video=@sample_video.avi" \
  -F "format=mp4"
                </div>

                <div class="response">
                    <h4>响应:</h4>
                    <div class="response-example">转换后的视频文件</div>
                </div>
            </div>

            <div class="endpoint">
                <span class="method post">POST</span>
                <span class="url">/video/compress</span>
                <div class="description">压缩视频文件</div>
                
                <div class="params">
                    <h4>参数:</h4>
                    <div class="param">
                        <div class="param-name">video</div>
                        <div class="param-type">文件 (multipart/form-data)</div>
                        <div>要压缩的视频文件</div>
                    </div>
                    <div class="param">
                        <div class="param-name">quality</div>
                        <div class="param-type">字符串 (可选，默认medium)</div>
                        <div>压缩质量 (low, medium, high)</div>
                    </div>
                </div>

                <div class="example">
curl -X POST http://localhost:5000/video/compress \
  -F "video=@sample_video.mp4" \
  -F "quality=medium"
                </div>

                <div class="response">
                    <h4>响应:</h4>
                    <div class="response-example">压缩后的视频文件 (MP4格式)</div>
                </div>
            </div>

            <div class="endpoint">
                <span class="method post">POST</span>
                <span class="url">/video/info</span>
                <div class="description">获取视频信息</div>
                
                <div class="params">
                    <h4>参数:</h4>
                    <div class="param">
                        <div class="param-name">video</div>
                        <div class="param-type">文件 (multipart/form-data)</div>
                        <div>要获取信息的视频文件</div>
                    </div>
                </div>

                <div class="example">
curl -X POST http://localhost:5000/video/info \
  -F "video=@sample_video.mp4"
                </div>

                <div class="response">
                    <h4>响应:</h4>
                    <div class="response-example">{
  "format": "mp4",
  "duration": 120.5,
  "resolution": "1920x1080",
  "fps": 30,
  "bitrate": "5000k",
  "size": "75.2MB"
}</div>
                </div>
            </div>

            <div class="endpoint">
                <span class="method post">POST</span>
                <span class="url">/video/add_background_music</span>
                <div class="description">为视频添加背景音乐（基础版本）</div>
                
                <div class="params">
                    <h4>参数:</h4>
                    <div class="param">
                        <div class="param-name">video</div>
                        <div class="param-type">文件 (multipart/form-data)</div>
                        <div>要添加背景音乐的视频文件</div>
                    </div>
                    <div class="param">
                        <div class="param-name">music</div>
                        <div class="param-type">文件 (multipart/form-data)</div>
                        <div>背景音乐文件</div>
                    </div>
                    <div class="param">
                        <div class="param-name">volume_ratio</div>
                        <div class="param-type">浮点数 (可选，默认0.3)</div>
                        <div>背景音乐音量比例 (0.0-1.0)</div>
                    </div>
                    <div class="param">
                        <div class="param-name">loop_music</div>
                        <div class="param-type">布尔值 (可选，默认true)</div>
                        <div>是否循环播放背景音乐</div>
                    </div>
                </div>

                <div class="example">
curl -X POST http://localhost:5000/video/add_background_music \
  -F "video=@sample_video.mp4" \
  -F "music=@background_music.mp3" \
  -F "volume_ratio=0.3" \
  -F "loop_music=true"
                </div>

                <div class="response">
                    <h4>响应:</h4>
                    <div class="response-example">添加背景音乐后的视频文件 (MP4格式)</div>
                </div>
            </div>

            <div class="endpoint">
                <span class="method post">POST</span>
                <span class="url">/video/add_background_music_with_options</span>
                <div class="description">为视频添加背景音乐（高级版本）</div>
                
                <div class="params">
                    <h4>参数:</h4>
                    <div class="param">
                        <div class="param-name">video</div>
                        <div class="param-type">文件 (multipart/form-data)</div>
                        <div>要添加背景音乐的视频文件</div>
                    </div>
                    <div class="param">
                        <div class="param-name">music</div>
                        <div class="param-type">文件 (multipart/form-data)</div>
                        <div>背景音乐文件</div>
                    </div>
                    <div class="param">
                        <div class="param-name">volume_ratio</div>
                        <div class="param-type">浮点数 (可选，默认0.3)</div>
                        <div>背景音乐音量比例 (0.0-1.0)</div>
                    </div>
                    <div class="param">
                        <div class="param-name">loop_music</div>
                        <div class="param-type">布尔值 (可选，默认true)</div>
                        <div>是否循环播放背景音乐</div>
                    </div>
                    <div class="param">
                        <div class="param-name">fade_in_duration</div>
                        <div class="param-type">浮点数 (可选，默认0)</div>
                        <div>淡入时长（秒）</div>
                    </div>
                    <div class="param">
                        <div class="param-name">fade_out_duration</div>
                        <div class="param-type">浮点数 (可选，默认0)</div>
                        <div>淡出时长（秒）</div>
                    </div>
                    <div class="param">
                        <div class="param-name">start_time</div>
                        <div class="param-type">浮点数 (可选，默认0)</div>
                        <div>音乐开始时间（秒）</div>
                    </div>
                    <div class="param">
                        <div class="param-name">end_time</div>
                        <div class="param-type">浮点数 (可选)</div>
                        <div>音乐结束时间（秒）</div>
                    </div>
                </div>

                <div class="example">
curl -X POST http://localhost:5000/video/add_background_music_with_options \
  -F "video=@sample_video.mp4" \
  -F "music=@background_music.mp3" \
  -F "volume_ratio=0.4" \
  -F "loop_music=true" \
  -F "fade_in_duration=2.0" \
  -F "fade_out_duration=3.0" \
  -F "start_time=10.0" \
  -F "end_time=60.0"
                </div>

                <div class="response">
                    <h4>响应:</h4>
                    <div class="response-example">添加背景音乐后的视频文件 (MP4格式)</div>
                </div>
            <div class="endpoint">
                <span class="method post">POST</span>
                <span class="url">/video/mask</span>
                <div class="description">应用遮挡到视频</div>
                
                <div class="params">
                    <h4>参数:</h4>
                    <div class="param">
                        <div class="param-name">video</div>
                        <div class="param-type">文件 (multipart/form-data)</div>
                        <div>要应用遮挡的视频文件</div>
                    </div>
                    <div class="param">
                        <div class="param-name">mask_data</div>
                        <div class="param-type">JSON字符串 (multipart/form-data)</div>
                        <div>遮挡数据，包含遮挡区域的位置和样式信息</div>
                    </div>
                    <div class="param">
                        <div class="param-name">is_preview</div>
                        <div class="param-type">字符串 (multipart/form-data，可选)</div>
                        <div>是否为预览模式，true/false，默认false。预览模式用于快速生成短视频进行效果预览</div>
                    </div>
                    <div class="param">
                        <div class="param-name">start_time</div>
                        <div class="param-type">数字 (multipart/form-data，可选)</div>
                        <div>开始时间（秒），默认0。指定从视频第几秒开始处理</div>
                    </div>
                    <div class="param">
                        <div class="param-name">duration</div>
                        <div class="param-type">数字 (multipart/form-data，可选)</div>
                        <div>持续时间（秒），默认5。指定处理多长时间的视频片段</div>
                    </div>
                </div>

                <div class="example">
# 完整处理视频
curl -X POST http://localhost:5000/video/mask \
  -F "video=@sample_video.mp4" \
  -F 'mask_data={
    "canvas": {"width": 1920, "height": 1080},
    "masks": [
      {
        "x": 100,
        "y": 50,
        "width": 200,
        "height": 100,
        "type": "rectangle",
        "color": "#ff4757",
        "opacity": 50
      }
    ]
  }'

# 预览模式 - 生成5秒预览视频
curl -X POST http://localhost:5000/video/mask \
  -F "video=@sample_video.mp4" \
  -F "is_preview=true" \
  -F "start_time=10" \
  -F "duration=5" \
  -F 'mask_data={
    "canvas": {"width": 1920, "height": 1080},
    "masks": [
      {
        "x": 100,
        "y": 50,
        "width": 200,
        "height": 100,
        "type": "rectangle",
        "color": "#ff4757",
        "opacity": 50
      }
    ]
  }'
                </div>

                <div class="response">
                    <h4>响应:</h4>
                    <div class="response-example">应用遮挡后的视频文件 (MP4格式)</div>
                </div>
            </div>

            <div class="endpoint">
                <span class="method post">POST</span>
                <span class="url">/video/merge_audio</span>
                <div class="description">合并视频和音频</div>
                
                <div class="params">
                    <h4>参数:</h4>
                    <div class="param">
                        <div class="param-name">video</div>
                        <div class="param-type">文件 (multipart/form-data)</div>
                        <div>要合并音频的视频文件</div>
                    </div>
                    <div class="param">
                        <div class="param-name">audio</div>
                        <div class="param-type">文件 (multipart/form-data)</div>
                        <div>要合并的音频文件</div>
                    </div>
                    <div class="param">
                        <div class="param-name">merge_type</div>
                        <div class="param-type">字符串 (可选，默认mix)</div>
                        <div>合并类型：mix（混合）或replace（替换）</div>
                    </div>
                    <div class="param">
                        <div class="param-name">original_volume</div>
                        <div class="param-type">浮点数 (可选，默认1.0)</div>
                        <div>原音频音量（0.0-2.0）</div>
                    </div>
                    <div class="param">
                        <div class="param-name">new_audio_volume</div>
                        <div class="param-type">浮点数 (可选，默认1.0)</div>
                        <div>新音频音量（0.0-2.0）</div>
                    </div>
                    <div class="param">
                        <div class="param-name">fade_in_duration</div>
                        <div class="param-type">浮点数 (可选，默认0)</div>
                        <div>淡入时长（秒）</div>
                    </div>
                    <div class="param">
                        <div class="param-name">fade_out_duration</div>
                        <div class="param-type">浮点数 (可选，默认0)</div>
                        <div>淡出时长（秒）</div>
                    </div>
                    <div class="param">
                        <div class="param-name">generate_preview</div>
                        <div class="param-type">布尔值 (可选，默认false)</div>
                        <div>是否生成预览视频</div>
                    </div>
                    <div class="param">
                        <div class="param-name">preview_duration</div>
                        <div class="param-type">整数 (可选，默认10)</div>
                        <div>预览视频时长（秒）</div>
                    </div>
                </div>

                <div class="example">
curl -X POST http://localhost:5000/video/merge_audio \
  -F "video=@sample_video.mp4" \
  -F "audio=@audio.mp3" \
  -F "merge_type=mix" \
  -F "original_volume=1.0" \
  -F "new_audio_volume=1.0" \
  -F "generate_preview=true" \
  -F "preview_duration=10"
                </div>

                <div class="response">
                    <h4>响应:</h4>
                    <div class="response-example">合并后的视频文件 (MP4格式，如果启用预览则只包含指定时长的片段)</div>
                </div>

                <div class="description">
                    <h4>功能说明:</h4>
                    <ul>
                        <li><strong>预览功能</strong>: 当 <code>generate_preview=true</code> 时，生成的视频将只包含指定时长的片段，用于快速预览音视频合并效果</li>
                        <li><strong>时长控制</strong>: <code>preview_duration</code> 参数控制预览视频的时长，默认10秒</li>
                        <li><strong>智能截取</strong>: 预览片段会从视频的中间部分开始，确保包含有意义的音视频内容</li>
                        <li><strong>完整处理</strong>: 当 <code>generate_preview=false</code> 或不设置时，生成完整的合并视频</li>
                    </ul>
                </div>
            </div>
        </div>

        <div class="category">
            <h2>🎬 视频合成 API</h2>
            <p>提供视频合成功能，包括文件上传、遮罩应用、字幕添加、音频合成和背景音乐添加</p>

            <div class="endpoint">
                <span class="method post">POST</span>
                <span class="url">/merge/upload_file</span>
                <div class="description">上传文件到合并临时文件夹，支持视频、音频和字幕文件</div>
                
                <div class="params">
                    <h4>参数:</h4>
                    <div class="param">
                        <div class="param-name">folder_name</div>
                        <div class="param-type">字符串</div>
                        <div>临时文件夹名称</div>
                    </div>
                    <div class="param">
                        <div class="param-name">file_type</div>
                        <div class="param-type">字符串</div>
                        <div>文件类型：video、audio、subtitle、background_music</div>
                    </div>
                    <div class="param">
                        <div class="param-name">file</div>
                        <div class="param-type">文件 (multipart/form-data)</div>
                        <div>要上传的文件</div>
                    </div>
                </div>

                <div class="example">
curl -X POST http://localhost:5000/merge/upload_file \
  -F "folder_name=my_project_123" \
  -F "file_type=video" \
  -F "file=@video.mp4"
                </div>

                <div class="response">
                    <h4>响应:</h4>
                    <div class="response-example">{
  "success": true,
  "message": "video文件上传成功",
  "folder_name": "my_project_123",
  "file_type": "video",
  "target_path": "/path/to/merge_temp/my_project_123/source.mp4"
}</div>
                </div>
            </div>

            <div class="endpoint">
                <span class="method post">POST</span>
                <span class="url">/merge/apply_mask</span>
                <div class="description">在视频区域下绘制遮罩</div>
                
                <div class="params">
                    <h4>参数:</h4>
                    <div class="param">
                        <div class="param-name">folder_name</div>
                        <div class="param-type">字符串</div>
                        <div>临时文件夹名称</div>
                    </div>
                    <div class="param">
                        <div class="param-name">mask_data</div>
                        <div class="param-type">JSON</div>
                        <div>遮罩数据，包含位置和样式信息</div>
                    </div>
                </div>

                <div class="example">
curl -X POST http://localhost:5000/merge/apply_mask \
  -F "folder_name=my_project_123" \
  -F 'mask_data={
    "masks": [
      {
        "type": "rectangle",
        "x": 100,
        "y": 100,
        "width": 200,
        "height": 150,
        "color": "#000000",
        "opacity": 0.8
      }
    ]
  }'
                </div>

                <div class="response">
                    <h4>响应:</h4>
                    <div class="response-example">{
  "success": true,
  "message": "遮罩应用成功",
  "masked_video_path": "/path/to/merge_temp/my_project_123/masked_video.mp4"
}</div>
                </div>
            </div>

            <div class="endpoint">
                <span class="method post">POST</span>
                <span class="url">/merge/add_subtitle</span>
                <div class="description">在视频中添加字幕</div>
                
                <div class="params">
                    <h4>参数:</h4>
                    <div class="param">
                        <div class="param-name">folder_name</div>
                        <div class="param-type">字符串</div>
                        <div>临时文件夹名称</div>
                    </div>
                    <div class="param">
                        <div class="param-name">subtitle_data</div>
                        <div class="param-type">JSON (可选)</div>
                        <div>字幕设置信息</div>
                    </div>
                </div>

                <div class="example">
curl -X POST http://localhost:5000/merge/add_subtitle \
  -F "folder_name=my_project_123" \
  -F 'subtitle_data={
    "font_size": 24,
    "font_color": "#FFFFFF",
    "background_color": "#000000",
    "background_opacity": 0.7,
    "position": "bottom"
  }'
                </div>

                <div class="response">
                    <h4>响应:</h4>
                    <div class="response-example">{
  "success": true,
  "message": "字幕添加成功",
  "subtitled_video_path": "/path/to/merge_temp/my_project_123/subtitled_video.mp4"
}</div>
                </div>
            </div>

            <div class="endpoint">
                <span class="method post">POST</span>
                <span class="url">/merge/merge_audio</span>
                <div class="description">合成语音</div>
                
                <div class="params">
                    <h4>参数:</h4>
                    <div class="param">
                        <div class="param-name">folder_name</div>
                        <div class="param-type">字符串</div>
                        <div>临时文件夹名称</div>
                    </div>
                    <div class="param">
                        <div class="param-name">merge_type</div>
                        <div class="param-type">字符串 (可选，默认mix)</div>
                        <div>合并类型：mix（混合）或replace（替换）</div>
                    </div>
                    <div class="param">
                        <div class="param-name">original_volume</div>
                        <div class="param-type">浮点数 (可选，默认1.0)</div>
                        <div>原音频音量（0.0-2.0）</div>
                    </div>
                    <div class="param">
                        <div class="param-name">new_audio_volume</div>
                        <div class="param-type">浮点数 (可选，默认1.0)</div>
                        <div>新音频音量（0.0-2.0）</div>
                    </div>
                    <div class="param">
                        <div class="param-name">fade_in_duration</div>
                        <div class="param-type">浮点数 (可选，默认0)</div>
                        <div>淡入时长（秒）</div>
                    </div>
                    <div class="param">
                        <div class="param-name">fade_out_duration</div>
                        <div class="param-type">浮点数 (可选，默认0)</div>
                        <div>淡出时长（秒）</div>
                    </div>
                </div>

                <div class="example">
curl -X POST http://localhost:5000/merge/merge_audio \
  -F "folder_name=my_project_123" \
  -F "merge_type=mix" \
  -F "original_volume=1.0" \
  -F "new_audio_volume=1.0"
                </div>

                <div class="response">
                    <h4>响应:</h4>
                    <div class="response-example">{
  "success": true,
  "message": "音频合成成功",
  "merged_audio_video_path": "/path/to/merge_temp/my_project_123/merged_audio_video.mp4"
}</div>
                </div>
            </div>

            <div class="endpoint">
                <span class="method post">POST</span>
                <span class="url">/merge/add_background_music</span>
                <div class="description">添加背景音乐</div>
                
                <div class="params">
                    <h4>参数:</h4>
                    <div class="param">
                        <div class="param-name">folder_name</div>
                        <div class="param-type">字符串</div>
                        <div>临时文件夹名称</div>
                    </div>
                    <div class="param">
                        <div class="param-name">volume_ratio</div>
                        <div class="param-type">浮点数 (可选，默认0.3)</div>
                        <div>背景音乐音量比例</div>
                    </div>
                    <div class="param">
                        <div class="param-name">loop_music</div>
                        <div class="param-type">布尔值 (可选，默认true)</div>
                        <div>是否循环播放音乐</div>
                    </div>
                    <div class="param">
                        <div class="param-name">fade_in_duration</div>
                        <div class="param-type">浮点数 (可选，默认0)</div>
                        <div>淡入时长（秒）</div>
                    </div>
                    <div class="param">
                        <div class="param-name">fade_out_duration</div>
                        <div class="param-type">浮点数 (可选，默认0)</div>
                        <div>淡出时长（秒）</div>
                    </div>
                    <div class="param">
                        <div class="param-name">start_time</div>
                        <div class="param-type">浮点数 (可选，默认0)</div>
                        <div>音乐开始时间（秒）</div>
                    </div>
                    <div class="param">
                        <div class="param-name">end_time</div>
                        <div class="param-type">浮点数 (可选)</div>
                        <div>音乐结束时间（秒）</div>
                    </div>
                </div>

                <div class="example">
curl -X POST http://localhost:5000/merge/add_background_music \
  -F "folder_name=my_project_123" \
  -F "volume_ratio=0.3" \
  -F "loop_music=true"
                </div>

                <div class="response">
                    <h4>响应:</h4>
                    <div class="response-example">{
  "success": true,
  "message": "背景音乐添加成功",
  "final_video_path": "/path/to/merge_temp/my_project_123/final_video.mp4"
}</div>
                </div>
            </div>

            <div class="endpoint">
                <span class="method get">GET</span>
                <span class="url">/merge/download_final_video</span>
                <div class="description">下载最终合成的视频文件</div>
                
                <div class="params">
                    <h4>查询参数:</h4>
                    <div class="param">
                        <div class="param-name">folder_name</div>
                        <div class="param-type">字符串</div>
                        <div>临时文件夹名称</div>
                    </div>
                </div>

                <div class="example">
curl -O -J "http://localhost:5000/merge/download_final_video?folder_name=my_project_123"
                </div>

                <div class="response">
                    <h4>响应:</h4>
                    <div class="response-example">最终合成的视频文件 (MP4格式)</div>
                    <p><strong>文件优先级:</strong></p>
                    <ol>
                        <li>final_video.mp4（最终合成视频）</li>
                        <li>merged_audio_video.mp4（音频合成后的视频）</li>
                        <li>subtitled_video.mp4（添加字幕后的视频）</li>
                        <li>masked_video.mp4（应用遮罩后的视频）</li>
                        <li>source.mp4（原始视频）</li>
                    </ol>
                </div>
            </div>

            <div class="endpoint">
                <span class="method post">POST</span>
                <span class="url">/merge/cleanup</span>
                <div class="description">清理合并临时文件夹</div>
                
                <div class="params">
                    <h4>参数:</h4>
                    <div class="param">
                        <div class="param-name">folder_name</div>
                        <div class="param-type">字符串</div>
                        <div>要清理的临时文件夹名称</div>
                    </div>
                </div>

                <div class="example">
curl -X POST http://localhost:5000/merge/cleanup \
  -F "folder_name=my_project_123"
                </div>

                <div class="response">
                    <h4>响应:</h4>
                    <div class="response-example">{
  "success": true,
  "message": "临时文件夹清理成功"
}</div>
                </div>
            </div>

            <div class="endpoint">
                <h3>🎬 视频合成工作流程</h3>
                <div class="description">
                    <p>视频合成API提供完整的工作流程，支持以下步骤：</p>
                    <ol>
                        <li><strong>上传文件</strong> - 将视频、音频、字幕文件上传到临时文件夹</li>
                        <li><strong>应用遮罩</strong> - 在视频区域下绘制遮罩（可选）</li>
                        <li><strong>添加字幕</strong> - 为视频添加字幕信息（可选）</li>
                        <li><strong>合成音频</strong> - 将音频与视频合并（可选）</li>
                        <li><strong>添加背景音乐</strong> - 为视频添加背景音乐（可选）</li>
                        <li><strong>下载最终视频</strong> - 获取处理完成的视频文件</li>
                        <li><strong>清理临时文件</strong> - 释放存储空间</li>
                    </ol>
                </div>

                <div class="example">
# 完整工作流程示例
# 1. 上传视频文件
curl -X POST http://localhost:5000/merge/upload_file \
  -F "folder_name=my_project_123" \
  -F "file_type=video" \
  -F "file=@video.mp4"

# 2. 上传音频文件
curl -X POST http://localhost:5000/merge/upload_file \
  -F "folder_name=my_project_123" \
  -F "file_type=audio" \
  -F "file=@audio.mp3"

# 3. 上传字幕文件
curl -X POST http://localhost:5000/merge/upload_file \
  -F "folder_name=my_project_123" \
  -F "file_type=subtitle" \
  -F "file=@subtitle.srt"

# 4. 应用遮罩（可选）
curl -X POST http://localhost:5000/merge/apply_mask \
  -F "folder_name=my_project_123" \
  -F 'mask_data={"masks":[{"type":"rectangle","x":100,"y":100,"width":200,"height":150,"color":"#000000","opacity":0.8}]}'

# 5. 添加字幕（可选）
curl -X POST http://localhost:5000/merge/add_subtitle \
  -F "folder_name=my_project_123" \
  -F 'subtitle_data={"font_size":24,"font_color":"#FFFFFF","position":"bottom"}'

# 6. 合成音频（可选）
curl -X POST http://localhost:5000/merge/merge_audio \
  -F "folder_name=my_project_123" \
  -F "merge_type=mix" \
  -F "original_volume=1.0" \
  -F "new_audio_volume=1.0"

# 7. 添加背景音乐（可选）
curl -X POST http://localhost:5000/merge/add_background_music \
  -F "folder_name=my_project_123" \
  -F "volume_ratio=0.3" \
  -F "loop_music=true"

# 8. 下载最终视频
curl -O -J "http://localhost:5000/merge/download_final_video?folder_name=my_project_123"

# 9. 清理临时文件夹
curl -X POST http://localhost:5000/merge/cleanup \
  -F "folder_name=my_project_123"
                </div>
            </div>
        </div>

        <div class="category">
            <h2>⚙️ 系统管理 API</h2>
            <p>提供健康检查、文件清理等系统管理功能</p>

            <div class="endpoint">
                <span class="method get">GET</span>
                <span class="url">/system/health</span>
                <div class="description">健康检查接口</div>

                <div class="example">
curl -X GET http://localhost:5000/system/health
                </div>

                <div class="response">
                    <h4>响应:</h4>
                    <div class="response-example">{
  "status": "healthy",
  "message": "视频工具服务运行正常",
  "system_info": {
    "platform": "Linux",
    "python_version": "3.9.23",
    "cpu_count": 8,
    "memory_total_gb": 7.66,
    "ffmpeg_available": true
  }
}</div>
                </div>
            </div>

            <div class="endpoint">
                <span class="method post">POST</span>
                <span class="url">/system/cleanup</span>
                <div class="description">清理临时文件</div>

                <div class="example">
curl -X POST http://localhost:5000/system/cleanup
                </div>

                <div class="response">
                    <h4>响应:</h4>
                    <div class="response-example">{
  "message": "文件清理完成"
}</div>
                </div>
            </div>

            <div class="endpoint">
                <span class="method get">GET</span>
                <span class="url">/system/fonts</span>
                <div class="description">获取系统支持的字体列表</div>

                <div class="params">
                    <h4>查询参数:</h4>
                    <div class="param">
                        <span class="param-name">language</span>
                        <span class="param-type">(可选) 语言代码，默认为 'zh'</span>
                    </div>
                    <div class="param">
                        <span class="param-name">include_test</span>
                        <span class="param-type">(可选) 是否包含字体渲染测试，默认为 'false'</span>
                    </div>
                </div>

                <div class="example">
curl -X GET "http://localhost:5000/system/fonts?language=zh&include_test=false"
                </div>

                <div class="response">
                    <h4>响应:</h4>
                    <div class="response-example">{
  "status": "success",
  "message": "获取字体列表成功",
  "data": {
    "fonts": [
      {
        "key": "arial",
        "name": "Arial",
        "description": "Arial字体，macOS系统字体",
        "path": "/System/Library/Fonts/ArialHB.ttc",
        "type": "ttc",
        "supported_languages": ["en", "zh", "ja", "ko"]
      }
    ],
    "recommended_fonts": {
      "zh": "/System/Library/Fonts/ArialHB.ttc",
      "en": "/System/Library/Fonts/ArialHB.ttc",
      "ja": "/System/Library/Fonts/ArialHB.ttc",
      "ko": "/System/Library/Fonts/ArialHB.ttc"
    }
  }
}</div>
                </div>
            </div>

            <div class="endpoint">
                <span class="method get">GET</span>
                <span class="url">/system/fonts/{font_key}</span>
                <div class="description">获取指定字体的详细信息</div>

                <div class="params">
                    <h4>路径参数:</h4>
                    <div class="param">
                        <span class="param-name">font_key</span>
                        <span class="param-type">字体键名 (dejavu, liberation, noto, noto_cjk, arial)</span>
                    </div>
                </div>

                <div class="example">
curl -X GET http://localhost:5000/system/fonts/dejavu
                </div>

                <div class="response">
                    <h4>响应:</h4>
                    <div class="response-example">{
  "status": "success",
  "message": "获取字体信息成功",
  "data": {
    "name": "DejaVu Sans",
    "description": "DejaVu字体，支持多种语言",
    "path": "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf",
    "type": "ttf",
    "supported_languages": ["en", "zh", "ja", "ko", "ar", "he", "th"],
    "available": true
  }
}</div>
                </div>
            </div>

            <div class="endpoint">
                <span class="method get">GET</span>
                <span class="url">/system/fonts/recommended</span>
                <div class="description">根据语言获取推荐字体</div>

                <div class="params">
                    <h4>查询参数:</h4>
                    <div class="param">
                        <span class="param-name">language</span>
                        <span class="param-type">语言代码 (zh, en, ja, ko, ar, he, th, hi, bn)</span>
                    </div>
                </div>

                <div class="example">
curl -X GET "http://localhost:5000/system/fonts/recommended?language=zh"
                </div>

                <div class="response">
                    <h4>响应:</h4>
                    <div class="response-example">{
  "status": "success",
  "message": "获取推荐字体成功",
  "data": {
    "language": "zh",
    "font_path": "/System/Library/Fonts/ArialHB.ttc"
  }
}</div>
                </div>
            </div>

            <div class="endpoint">
                <span class="method post">POST</span>
                <span class="url">/system/fonts/test</span>
                <div class="description">测试字体渲染功能</div>

                <div class="params">
                    <h4>请求体:</h4>
                    <div class="param">
                        <span class="param-name">font_path</span>
                        <span class="param-type">字体文件路径</span>
                    </div>
                </div>

                <div class="example">
curl -X POST "http://localhost:5000/system/fonts/test" \
  -H "Content-Type: application/json" \
  -d '{"font_path": "/System/Library/Fonts/ArialHB.ttc"}'
                </div>

                <div class="response">
                    <h4>响应:</h4>
                    <div class="response-example">{
  "status": "success",
  "message": "字体渲染测试完成",
  "data": {
    "font_path": "/System/Library/Fonts/ArialHB.ttc",
    "rendering_success": true
  }
}</div>
                </div>
            </div>
        </div>

        <h2>📁 支持的文件格式</h2>
        <div class="endpoint">
            <h3>视频格式:</h3>
            <ul>
                <li>MP4 (.mp4)</li>
                <li>AVI (.avi)</li>
                <li>MOV (.mov)</li>
                <li>MKV (.mkv)</li>
                <li>WMV (.wmv)</li>
                <li>FLV (.flv)</li>
            </ul>
            
            <h3>音频格式:</h3>
            <ul>
                <li>MP3 (.mp3)</li>
                <li>WAV (.wav)</li>
                <li>AAC (.aac)</li>
                <li>OGG (.ogg)</li>
                <li>FLAC (.flac)</li>
            </ul>
            
            <h3>字幕格式:</h3>
            <ul>
                <li>SRT (.srt)</li>
                <li>ASS (.ass)</li>
                <li>SSA (.ssa)</li>
            </ul>
            
            <h3>字体格式:</h3>
            <ul>
                <li>TTF (.ttf) - TrueType字体</li>
                <li>TTC (.ttc) - TrueType集合字体</li>
                <li>OTF (.otf) - OpenType字体</li>
            </ul>
            
            <h3>支持的字体:</h3>
            <ul>
                <li><strong>DejaVu Sans</strong> - 支持多种语言，包括中文、日文、韩文、阿拉伯文等</li>
                <li><strong>Liberation Sans</strong> - 开源替代字体，支持英文、中文、日文、韩文</li>
                <li><strong>Noto Sans</strong> - Google Noto字体，支持所有语言</li>
                <li><strong>Noto Sans CJK</strong> - 专门支持中日韩文字</li>
                <li><strong>Arial</strong> - macOS系统字体，支持英文、中文、日文、韩文</li>
            </ul>
        </div>

        <h2>⚠️ 错误处理</h2>
        <div class="endpoint">
            <p>API使用标准HTTP状态码表示请求结果：</p>
            <ul>
                <li><strong>200</strong>: 请求成功</li>
                <li><strong>400</strong>: 请求参数错误</li>
                <li><strong>404</strong>: 资源不存在（如字体不存在）</li>
                <li><strong>500</strong>: 服务器内部错误</li>
            </ul>
            
            <p>错误响应格式：</p>
            <div class="example">{
  "error": "错误描述信息"
}</div>
            
            <h4>字体相关错误示例：</h4>
            <div class="example">// 404 - 字体不存在
{
  "status": "error",
  "message": "字体 dejavu 不存在"
}

// 404 - 未找到推荐字体
{
  "status": "error", 
  "message": "未找到适合语言 zh 的字体"
}

// 400 - 缺少参数
{
  "status": "error",
  "message": "缺少字体路径参数"
}</div>
        </div>

        <h2>🔧 部署说明</h2>
        <div class="endpoint">
            <h3>Docker部署:</h3>
            <div class="example"># 构建镜像
docker build -t video-tools .

# 运行容器
docker run -d -p 5000:5000 video-tools

# 使用Docker Compose
docker-compose up -d</div>
            
            <h3>直接运行:</h3>
            <div class="example"># 安装依赖
pip install -r requirements.txt

# 启动服务
python main.py</div>
        </div>
    </div>
</body>
</html> 